import {useUserStore} from "@/stores";
import router from "@/routes/router";

export default {
  // 指令选项
  mounted(el, binding) {
    const permission = binding.value;
    const currentR = router.currentRoute.value.name;
    const {userData} = useUserStore()
    const have_permissions = userData.permission_func[currentR] || ''
    if (!have_permissions.includes(permission)) {
      el.parentElement.removeChild(el)
    }
  },
  updated(el, binding) {
    // 组件更新时的操作
  },
  unmounted(el, binding) {
    // 解绑时的操作
  }
}